#include <stdio.h>
#include "list.h"

void Print(DYMListDataType* data)
{
    if(data == NULL) return;
    printf("<-Student-> Number: %lld, Sex: %s, Name: %s\n", data->ID, data->sex, data->name);
}

int compare(const DYMListDataType* a, const DYMListDataType* b)
{
    if(a->ID == b->ID) return 1;
    return 0;
}

int main()
{
    struct student tmp[3] = {
        {.ID = 16205140106, .sex ="F", .name = "SunYu"},
        {.ID = 16205140106, .sex ="F", .name = "SunYu"},
        {.ID = 16205140106, .sex ="F", .name = "SunYu"}
    };

    DYMList list = DYMListCreateList();
    DYMListPushFront(&list, tmp[0]);
    DYMListPushFront(&list, tmp[0]);
    DYMListPushFront(&list, tmp[0]);

    DYMListForeach(&list, Print);

    DYMListDelete(&list, tmp[0], compare);
    DYMListForeach(&list, Print);
    return 0;
}